<?php

	session_start();

	require_once('../config.php');
	include_once("../database/DataBase.php");
	include_once("../include/function.php");

	checkLogin();
	
	$database = New DataBase();
	$database->open_connection();
	$category = $database->getProductCategoryByCID($_SESSION["company_id"]);
?>


<!DOCTYPE html>
<html>
	<head>
	<title>CMS</title>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<?php
		include_once("../include/includeHeader.php");
	?>
	</head>
	<body>

			<?php
				include_once("../include/top_navigation.php");
			?>
			<div Class="Middle">
				<div class="LeftMenu">
					<?php include_once("../include/left_menu.php"); ?>
				</div>
				<div id="RightContent" >
					<h2>Update Category</h2>
					<form name="search_from" method="POST" >
						<table>
						<tr>
							<td>
								<input type="text" name="keyword" id="keyword" value="">
							</td>
							<td>
								<input type="button" name="click_button" value="Search" onclick="javascript: SearchCategory(document.search_from);"/>
							</td>
						</tr>
						</table>
						<br/>
						<div id="sarch_result">
							<table>
								<tr>
									<td>Name</td>
									<td>Description</td>
									<td>Create date</td>
									<td>Modify Date</td>
									<td>Action</td>
									
								</tr>
							<?
								while ($row = mysql_fetch_assoc($category)) {
									echo "<tr>";
									echo "<td>".$row["name"]."</td>";
									echo "<td>".$row["description"]."</td>";
									echo "<td>".$row["create_date"]."</td>";
									echo "<td>".$row["modify_date"]."</td>";
									echo "<td><a href='product_edit_category.php?key=".encrypt_string($row["category_id"])."'>Edit</a> / <a href=\"#\" onclick=\"deleteProductCategory('".encrypt_string($row["category_id"])."')\";>Delete</a></td>";
									echo "</tr>";
								}
							?>
							</table>						
						</div>
					</form>
				</div>
			</div>
			<?php
				include_once("../include/footer.php");
			?>

		
	</body>
</html>